package models.dao;

import java.sql.ResultSet;
import java.util.ArrayList;

import model.pojo.CustomerGroup;
import model.util.MySqlDataAccessHelper;

public class GroupIDDAO {
	
	public ArrayList<CustomerGroup> cusgrouplst(){
		ArrayList<CustomerGroup> lst = new ArrayList<CustomerGroup>();
		MySqlDataAccessHelper mysql = new MySqlDataAccessHelper();
		try{
			mysql.open();
			String ten="GroupNameVN";
			String sql ="select GroupID,"+ten+" from customergroup";
			ResultSet rs=mysql.executeQuery(sql);
			CustomerGroup cg;
			while(rs.next()){
				cg = new CustomerGroup();
				cg.setGroupID(rs.getString("GroupID"));
				cg.setGroupname(rs.getString(ten));
			}
			rs.close();
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			mysql.close();
		}
		return lst;
	}
}
